<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>一个可爱的小路由</title>
</head>
<body>

<a href="#/list">我是第一个</a>
<button id="mem">点我</button>
<p id="view"></p>

<script src="router.js"></script>
<script>
  var router = new Router({
    view: '#view',
    routes: {
      '/': function () {
        this.v.ele.innerHTML = '-------hello world-------';
        console.log(this);
      },
      '/list': function () {
        this.v.ele.innerHTML = '我是第一个';
      },
      '/admin/v:id': function () {
        var v = this.v;
        v.ele.innerHTML = '我是有id的：' + v.id + ' data:' + v.data;
      }
    }
  });

  var mem = document.getElementById('mem');
  mem.onclick = function () {
    router.go('/admin/v/637311', 'cicime');
  };
</script>
</body>
</html>